import $ from "./http";

const Get = ({ url, data }) => {
  return $({
    method: "get",
    url,
    params: data,
  });
};

const Post = ({ url, data }) => {
  return $({
    method: "post",
    url,
    data,
  });
};

const Put = ({ url, data }) => {
  return $({
    method: "put",
    url,
    data,
  });
};

const Del = (url) => {
  return $({
    method: "delete",
    url,
  });
};

const Up = (file) => {
  const data = new FormData();
  data.append("file", file);
  return $({
    method: "post",
    url: "/upload/uploadFile",
    data,
  });
};


const Dow = (id) => {
  // return $({
  //   method: "get",
  //   url: "/upload/downloadAnnex/"+id,
  //   responseType: "blob",
  // }).then((response) => {
  // });
  window.open('http://cqs.glbpower.com:8091/cqs/upload/download/' + id, '_blank')
}



export default {
  Get,
  Post,
  Put,
  Del,
  Up,
  Dow,
};

